package librarianPanels;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JLabel;
import javax.swing.border.LineBorder;
import javax.swing.JTextField;
import javax.swing.JButton;

import clientGUI.MainGUI;
import clientGUI.PanelDesign;
import javax.swing.JPanel;

public class ReturnABookPanel extends PanelDesign {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public JTextField textFieldReturnBookID;
	public JTextField textFieldCopy;
	public JButton btnSubmit;
	/**
	 * Create the panel.
	 */
	public ReturnABookPanel() 
	{
		setBorder(new LineBorder(new Color(0, 0, 0), 3, true));
		setLayout(null);
		setPreferredSize(new Dimension(644, 462));
		JLabel lblN = new JLabel("Return A Book");
		lblN.setFont(new Font("Tahoma", Font.PLAIN, 29));
		lblN.setBounds(217, 11, 209, 73);
		add(lblN);
		
		JPanel panel = new JPanel();
		panel.setBounds(215, 148, 202, 94);
		add(panel);
		panel.setLayout(null);
		
		textFieldReturnBookID = new JTextField();
		textFieldReturnBookID.setBounds(72, 0, 130, 20);
		panel.add(textFieldReturnBookID);
		textFieldReturnBookID.setColumns(10);
		
		btnSubmit = new JButton("Submit");
		btnSubmit.setBounds(72, 71, 89, 23);
		panel.add(btnSubmit);
		
		JLabel lblBookId = new JLabel("Book ID:");
		lblBookId.setBounds(0, 3, 62, 14);
		panel.add(lblBookId);
		
		textFieldCopy = new JTextField();
		textFieldCopy.setBounds(72, 25, 130, 20);
		panel.add(textFieldCopy);
		textFieldCopy.setColumns(10);
		
		JLabel lblNewLabelCopy = new JLabel("copy:");
		lblNewLabelCopy.setBounds(0, 28, 62, 14);
		panel.add(lblNewLabelCopy);
		btnSubmit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) 
			{
				String[] s=new String[3];
				s[0]="ReturnABook";
				s[1]=textFieldReturnBookID.getText();
				s[2]=textFieldCopy.getText();
				MainGUI.OBLClient.handleMessageFromClient(s);
			}
		});
		
		
		JLabel label = new JLabel("Please Enter Details:");
		label.setFont(new Font("Tahoma", Font.BOLD, 16));
		label.setBounds(227, 97, 180, 33);
		add(label);
		remove(background);
		add(background);
	}
}
